package cn.chenhongchao.zhaobiaopingtai.controller;

import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.BidReport;
import cn.chenhongchao.zhaobiaopingtai.entity.WinBidApproval;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderCompiledReportServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.jws.Oneway;

@RestController
@CrossOrigin
@RequestMapping("/tenderCompiledReport")
public class TenderCompiledReportController {


    @Autowired
    private TenderCompiledReportServiceImpl tenderCompiledReportService;

    @Autowired
    private BidServiceImpl bidService;


    @RequestMapping("/getTenderByCompiledReport")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize,
                                        @RequestBody ReturnBidDTO returnBidDTO) {

        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 1;
        }

        CommonPage<BidReport> returnBidCommonPage = bidService.getTenderByCompiledReport(pageNum, pageSize, returnBidDTO);
        return CommonResult.success(returnBidCommonPage);

    }
}
